package oo;

class Fish{
	int weight;
}
class Lake{    
	Fish fish;
	void setFish(Fish s){
		fish = s;}
	
	void eat(int n){
		fish.weight =fish .weight + n;
		Fish caoyu = new Fish();
		System.out.println(caoyu.weight);/////输出1
		}
	
}
class FishandLake{
	public static void main(String[] args) {
		Fish caoyu = new Fish();
		Fish bailian = new Fish();
		System.out.println(caoyu.weight);////输出2
		System.out.println(bailian.weight);//输出3
		Lake chaobaihu  = new Lake();
		Lake tianchi = new Lake();
		taihu.setFish(caoyu);
		chaobaihu.eat(15);
		tianchi.setFish(caoyu);
		System.out.println(tianchi.fish.weight);//输出4
		tianchi.eat(20);
		System.out.println(caoyu.weight);//输出5
		System.out.println(chaobaihu.fish.weight);//输出6
		System.out.println(tianchi.fish.weight);//输出7
	}
}

